package com.tepth.vehiclemaintenance.mvp.work.history;

import com.tepth.vehiclemaintenance.bean.VehicleMaintain;
import com.tepth.vehiclemaintenance.net.ApiModel;
import com.tepth.vehiclemaintenance.net.observer.SimpleDisposableObserver;

import java.util.ArrayList;

/**
 * Created by TMVPHelper on 2017/05/11
 */
public class HistoryPresenter extends HistoryContract.Presenter {

    @Override
    void getVehicleHistory() {
        mRxManager.add(mModel.getVehicleHistory(mView.getAuthKey(), mView.getStartTime(),
                mView.getEndTime(), mView.getNumber())
                .subscribeWith(new SimpleDisposableObserver<ApiModel<ArrayList<VehicleMaintain>>>(mView) {
                    @Override
                    public void onSucceed(Object o) {
                        ArrayList<VehicleMaintain> list = (ArrayList<VehicleMaintain>) o;
                        mView.showList(list);
                    }
                }));
    }
}